<!DOCTYPE html>
<html lang="en">
<#include "../common/common.ftl">
<body>
<div id="wrapper" class="toggled">
    <#-- 侧边栏 -->
    <#include "../common/nav.ftl">

    <#-- 主要内容 -->
    <div id="page-content-wrapper">
        <div class="container-fluid">
            <div class="row clearfix">
                <div class="col-md-12 column">
                    <form class="form-horizontal col-md-6" role="form" action="/sell/seller/product/save" method="post">
                        <input type="hidden" name="productId" value="${(productInfo.productId)!''}" />
                        <div class="form-group">
                            <label for="productName" class="col-sm-2 control-label">名称</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="productName" name="productName" value="${(productInfo.productName)!''}" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="productPrice" class="col-sm-2 control-label">价格</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="productPrice" name="productPrice" value="${(productInfo.productPrice?string.computer)!''}" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="productStock" class="col-sm-2 control-label">库存</label>
                            <div class="col-sm-10">
                                <input type="number" class="form-control" id="productStock" name="productStock" value="${(productInfo.productStock?string.computer)!''}" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="productDescription" class="col-sm-2 control-label">描述</label>
                            <div class="col-sm-10">
                                <textarea rows="5" class="form-control" id="productDescription" name="productDescription">${(productInfo.productDescription)!''}</textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="productIcon" class="col-sm-2 control-label">图片</label>
                            <div class="col-sm-10">
                                <#if (productInfo.productId)??>
                                    <img src="${productInfo.productIcon}"
                                         alt="${productInfo.productName}"
                                         style="width: 200px; height: 200px; margin-bottom: 20px;" />
                                </#if>
                                <input type="text" class="form-control" id="productIcon" name="productIcon" value="${(productInfo.productIcon)!''}" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="categoryType" class="col-sm-2 control-label">类目</label>
                            <div class="col-sm-10">
                                <select class="form-control" id="categoryType" name="categoryType">
                                    <#list productCategories as category>
                                        <option value="${category.categoryType}"
                                            <#if productInfo.categoryType?? && productInfo.categoryType==category.categoryType>
                                             selected
                                            </#if>
                                         >${category.categoryName}</option>
                                    </#list>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" class="btn btn-default btn-primary">提交</button>
                                <#if productInfo.productId??>
                                    <a href="/sell/seller/product/list" class="btn btn-default btn-primary">返回列表</a>
                                </#if>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<#include "../common/js.ftl">
</body>
</html>